﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace N6SCRM.APP
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private static Splash AppSplash;
        private static MainWindow AppMain;

        public static void ShowAppMain()
        {
            if (AppMain == null)
            {
                AppMain = new MainWindow();
                App.Current.MainWindow = AppMain;
              //  AppMain.Visibility = Visibility.Hidden;
                AppMain.Show();
            }
            AppMain.Visibility = Visibility.Visible;
            //AppMain.UpdateLayout();
        }

        public static void HideAppMain()
        {
            //if (AppMain == null)
            //{
            //    AppMain = new MainWindow();
            //    AppMain.Visibility = Visibility.Hidden;
            //    AppMain.Show();
            //}
            AppMain.Visibility = Visibility.Hidden;
        }

        public static void ShowAppSplash()
        {
            if (AppSplash == null)
            {
                AppSplash = new Splash();
                AppSplash.Visibility = Visibility.Hidden;
                AppSplash.Show();
            }
            AppSplash.Visibility = Visibility.Visible;
        }

        public static void HideAppSplash()
        {
            if (AppSplash == null)
            {
                AppSplash = new Splash();
                AppSplash.Visibility = Visibility.Hidden;
                AppSplash.Show();
            }
            AppSplash.Visibility = Visibility.Hidden;
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {

            ShowAppSplash();
            System.Threading.Thread.Sleep(2500);
            ShowAppMain();
            HideAppSplash();

        }
    }
}
